﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 条款对应
/// </summary>
[Route("QHSEDangerClauseAssocition/[action]")]
[ApiController]
public class QHSEDangerClauseAssocitionController : ControllerBase
{
    private readonly QHSEDangerClauseAssocitionService _dangerClauseAssocitionService;

    public QHSEDangerClauseAssocitionController(QHSEDangerClauseAssocitionService dangerClauseAssocitionService)
    {
        _dangerClauseAssocitionService = dangerClauseAssocitionService;
    }
    /// <summary>
    /// 列表
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> List()
    {
        List<QHSEDangerClauseAssocitionModel> menus = await _dangerClauseAssocitionService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 查询
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> ClausResult([FromBody] IdInputModel idInput)
    {
        var data = await _dangerClauseAssocitionService.GetClauseResult(idInput);
        return AppResult.Status200OK(data: data);
    }
}
